<div class="content-section implementation GridDemo clearfixes outbound">
  <div class="mysearch">
   <div class="ui-g">
    <div class="ui-g-3 ui-sm-12">
      <label class="ui-g-3 ui-sm-5 text-right" >借用单号:</label>
      <div class="ui-g-9  ui-sm-7 ui-fluid">
        <input pInputText type="text" name="sid" placeholder="借用单号" [(ngModel)]="queryModel.condition.sid" />
      </div>
    </div>
    <div class="ui-g-3 ui-sm-12">
      <label class="ui-g-3 ui-sm-5 text-right">部门名称:</label>
      <div class="ui-g-9  ui-sm-7 ui-fluid">
        <input pInputText type="text" name="sid" placeholder="部门名称" [(ngModel)]="queryModel.condition.org" />
      </div>
    </div>
    <div class="ui-g-2 ui-sm-12">
      <label  class="ui-g-3 ui-sm-5 text-right">状态:</label>
      <div class="ui-g-9  ui-sm-9 ui-fluid ">
        <p-dropdown [options]="MaterialStatusData" [(ngModel)]="queryModel.condition.status" [autoWidth]="false" name="cycle" (onChange)="suggestInsepectiones()" ></p-dropdown>
      </div>
    </div>
    <div class="ui-g-2 ui-sm-12">
      <div class="ui-g-12 ui-sm-12 option">
        <button pButton type="button" label="查询" ngClass="ui-sm-12" (click)="suggestInsepectiones()" ></button>
        <button pButton label="清空" ngClass="ui-sm-12" (click)="clearSearch()"></button>
      </div>
    </div>
  </div>
  </div>
  <p-dataTable [value]="MaterialData"
               [totalRecords]="totalRecords"  [(selection)]="selectMaterial">
    <p-column  field="sid" header="借用单号" [sortable]="true" >
      <ng-template let-data="rowData" pTemplate="body" let-i="rowIndex">
        <span (click)="viewBorrowApproved(data)" class="curser">{{data.sid}}</span>
      </ng-template>
    </p-column>
    <p-column  *ngFor="let col of cols" field="{{col.field}}" header="{{col.header}}"  [sortable]="true"></p-column>
    <p-column header="操作">
      <ng-template let-car="rowData" pTemplate="body" let-i="rowIndex">
        <button pButton type="button"  label="编辑"  (click)="updateOption(MaterialData[i])" *ngIf="MaterialData[i]['status'] === '新建' ||MaterialData[i]['status'] === '驳回'" ></button>
        <button pButton type="button"  label="审批"  (click)=" borrowApproved(MaterialData[i])" *ngIf="MaterialData[i]['status'] === '待审批'"  ></button>
        <button pButton type="button"  label="出库" (click)="updateOutboundQuantity(MaterialData[i])" *ngIf="MaterialData[i]['status'] === '待借用'"></button>
        <button pButton type="button"  label="续借" (click)="showRestartMask(MaterialData[i],i)" *ngIf="MaterialData[i]['status'] === '待归还'" ></button>
        <button pButton type="button"  label="部分归还"   (click)="someDeliveryReturn(MaterialData[i],i)" *ngIf="MaterialData[i]['status'] === '待归还'"></button>
        <button pButton type="button"  label="全部归还"   (click)="deliveryReturn(MaterialData[i],i)" *ngIf="MaterialData[i]['status'] === '待归还'"></button>
        <button pButton type="button"  label="删除" (click)="deleteMaterial(MaterialData[i])"  *ngIf="MaterialData[i]['status'] === '新建'"  ></button>
        <button pButton type="button"  label="查看"   (click)=" viewBorrowApproved(MaterialData[i])"  ></button>
      </ng-template>
    </p-column>
    <ng-template pTemplate="emptymessage">
      当前没有数据
    </ng-template>
  </p-dataTable>
  <p-paginator rows="10" [totalRecords]="totalRecords" [rowsPerPageOptions]="[10,20,30]" (onPageChange)="paginate($event)"></p-paginator>
</div>

<app-borrow-restart
  *ngIf="showRestart"
  (closeRestart)="closeRestartMask($event)"
  (updateDev)="updateInventoryModel($event)"
  [currentBorrow]="currentBorrow"
></app-borrow-restart>

